package notification

import (
	"github.com/flipped-aurora/gin-vue-admin/server/model/common/response"
	request_model "github.com/flipped-aurora/gin-vue-admin/server/model/notification/request"
	"github.com/gin-gonic/gin"
)

type MessageApi struct {
}

func (m MessageApi) SendNotification(ctx *gin.Context) {
	var req request_model.SendMessageRequest
	if bindErr := ctx.ShouldBindJSON(&req); bindErr != nil {
		response.FailWithMessage(bindErr.Error(), ctx)
		return
	}

	var errSend = messageService.SendMessage(ctx, req)
	if errSend != nil {
		response.FailWithMessage(errSend.Error(), ctx)
		return
	}
	response.Ok(ctx)
}
